home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.6
/
xgrabsc.6
< prev
next >
Wrap
Text File
|
1995-07-25
|
26KB
|
595 lines
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
NNNNAAAAMMMMEEEE
xgrabsc - grab rectangular screen images and store in files
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
_x_g_r_a_b_s_c [----dddd _d_i_s_p_l_a_y] [----iiiidddd _w_i_n_d_o_w_I_d] [----oooo _o_u_t_p_u_t_F_i_l_e]
[----ssss _s_e_c_o_n_d_s] [----ppppoooosssstttt _s_e_c_o_n_d_s] [----bbbb _p_e_r_c_e_n_t]
[----aaaannnndddd _a_n_d_B_i_t_s] [----oooorrrr _o_r_B_i_t_s] [----ppppaaaaggggeeee _w_i_d_t_h_x_h_e_i_g_h_t-
_h_m_a_r_g-_v_m_a_r_g] [----bbbbeeeellllllll ----ggggrrrraaaabbbb ----vvvveeeerrrrbbbboooosssseeee ----bbbbddddrrrrssss ----nnnnoooobbbbddddrrrrssss
----kkkkeeeeyyyy ----ssssttttrrrreeeettttcccchhhh ----rrrrooooooootttt ----cccclllliiiicccckkkk ----ccccoooooooorrrrddddssss _w_i_d_t_h_x_h_e_i_g_h_t+_x+_y
----rrrreeeevvvveeeerrrrsssseeee ----bbbbwwww ----mmmmddddiiiitttthhhheeeerrrr ----ddddiiiitttthhhheeeerrrr ----hhhhaaaallllffffttttoooonnnneeee
----ppppssss ----ccccppppssss ----ssssiiiimmmmpppplllleeee ----xxxxwwwwdddd ----xxxxwwwwddddxxxxyyyy ----bbbbmmmm ----bbbbmmmm2222 ----bbbbmmmm3333 ----ppppuuuuzzzzzzzzlllleeee
----bbbbiiiinnnn ----ccccoooommmmpppp ----eeeeppppssss ----llll ----lllliiiimmmmiiiitttt ----pppprrrreeeevvvviiiieeeewwww ----pppprrrreeeevvvv
----pppprrrreeeevvvviiiieeeewwwwoooonnnnllllyyyy ----ccccoooollllpppprrrroooocccc]
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_x_g_r_a_b_s_c lets you grab arbitrary rectangular images from an X
server and writes them to standard output in a variety of
formats.
Command line options also allow reduction of colormaps,
halftoning and dithering of color images, and direct mapping
of color images to monochrome.
Options must be seperated with spaces or tabs. They may be
preceded with a dash, but this optional and provided for
Un*x addicts. Many may also be prefixed with 'no', or an
additional dash, to turn them off.
The default output format is gray-scale non-encapsulated
Postscript, with image compression (if image compression
significantly reduces the amount of output).
If you desire an output format not produced by xgrabsc, try
using the PBM package by Jef Poskanzer to convert xgrabsc to
that format. PBM can read xgrabsc's XWD output and convert
it to a lot of different formats.
GGGGEEEENNNNEEEERRRRAAAALLLL OOOOPPPPTTTTIIIIOOOONNNNSSSS
-d _d_i_s_p_l_a_y_N_a_m_e or -display _d_i_s_p_l_a_y_N_a_m_e
Use an alternate display. If no display is
specified on the command line, xgrabsc looks for the
environment variable DISPLAY for the name of the
display and screen to grab from. Note that you must
have permission to access the display on another
computer.
-bell The display's bell is normally rung while the screen
is being accessed. This turns the bell on or off
(-_n_o_b_e_l_l will turn it _o_f_f).
-grab Enable server grabs. Normally xgrabsc will "grab"
the server so that the screen is frozen while a
Page 1 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
rectangle is selected and the image is extracted.
If the screen is not frozen, rubber-banding may
cause video droppings on portions of the screen that
are changing. Use -_n_o_g_r_a_b to turn off server grabs.
-o _o_u_t_p_u_t-_f_i_l_e or -output _o_u_t_p_u_t-_f_i_l_e
Write output to _o_u_t_p_u_t-_f_i_l_e instead of standard
output. The output-file name, minus directory and
extension, is used as the internal name for the
image in formats supporting image names.
Postscript, xwd, pixmap and bitmap formats all
support image names.
-s _s_e_c_o_n_d_s or -sleep _s_e_c_o_n_d_s
Sleep for _s_e_c_o_n_d_s seconds before commencing
operation. This should be used if you need some
time to get the target image ready.
-post _s_e_c_o_n_d_s
Sleep for _s_e_c_o_n_d_s seconds after window/rectangle
selection. This is commonly used to pop up menus
after a window has been selected but before xgrabsc
takes its snapshot.
-verbose
Display processing information on standard error
output (stderr).
SSSSEEEELLLLEEEECCCCTTTTIIIIOOOONNNN OOOOPPPPTTTTIIIIOOOONNNNSSSS
-id _w_i_n_d_o_w _I_D
Dump the window with the given ID.
-key Select the window under the mouse when the Control key
is pressed. This option is normally used in getting
images of menus. Pop up the menu, optionally move the
pointer to the window containing the menu, and strike
the Control key to begin the dump.
-root
Dump the entire screen (root window).
-stretch
Use rubber-band rectangle to select region to grab.
This is the default.
-click
Wait for a click on a window and dump the selected
window.
Page 2 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
-coords _w_i_d_t_h_x_h_e_i_g_h_t+_x+_y
Selects the given area of the screen, without mouse or
keyboard interaction. Use this if you need to grab the
same area of the screen over and over again.
IIIIMMMMAAAAGGGGEEEE PPPPRRRROOOOCCCCEEEESSSSSSSSIIIINNNNGGGG OOOOPPPPTTTTIIIIOOOONNNNSSSS
-nobdrs or -noborders
Remove window-manager borders from window images. This
option applies only to selection by ID (-_i_d) or xwd-
style selection (-_c_l_i_c_k).
-bdrs or -borders
Include window-manager borders in window images. This
option applies only to selection by ID (-_i_d) or xwd-
style selection (-_c_l_i_c_k). Use -_n_o_b_d_r_s or -_n_o_b_o_r_d_e_r_s to
turn it off.
-b _p_e_r_c_e_n_t or -brighten _p_e_r_c_e_n_t
brighten or darken the image by _p_e_r_c_e_n_t. Percentages
are given as integers. 100 is the base and a larger
number will brighten the image while a smaller number
will darken the image.
-and _a_n_d_B_i_t_s
Clear all colormap bits up to the given plane. This
has the effect of darkening the image somewhat and
shrinking the apparent depth of the image (and,
consequently, the size of the color table). _A_n_d_B_i_t_s
should be in the range [1-8] inclusive.
-or _o_r_B_i_t_s
Set all colormap bits up to the given plane. This
brightens the image somewhat and also shrinks the
apparent depth of the image. When both -A and -O are
specified, ANDing will occur before ORing.
-reverse
Reverse the colors in the image. The bits of each
color used in the image are inverted.
-bw Convert the source color image to a monochrome bitmap.
All colors falling below the average color intensity
are mapped to black. Others are mapped to white.
-halftone
Convert the source color image to a halftoned monchrome
bitmap. Resolution is maintained by increasing the
size of the image by a factor of four on both axes.
Page 3 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
-mdither
Convert the source color image to a dithered monochrome
bitmap. This is like halftoning, but resolution is
sacrificed to keep the resulting image the same size as
the original. The matrix dithering algorithm used with
this option is most suitable for line-drawings and
text. For more complex graphics the -_d_i_t_h_e_r option is
recommended.
-dither
Convert the source color image to a dithered monochrome
bitmap with the Floyd-Steinberg algorithm.
-nodither
Turns off any dithering. Use this if your XXXXGGGGRRRRAAAABBBBSSSSCCCC
environment variable specifies dithering and you want
to override it to produce an undithered image.
OOOOUUUUTTTTPPPPUUUUTTTT FFFFOOOORRRRMMMMAAAATTTT OOOOPPPPTTTTIIIIOOOONNNNSSSS
-cps Write output in _P_o_s_t_s_c_r_i_p_t format using the colorimage
operator for color printers. Color to grayscale
conversion is bundled into the output so you can
actually use either color or cheaper grayscale
printers. For monochrome displays, the -_p_s option will
give more compact output.
-ps Write output in _P_o_s_t_s_c_r_i_p_t format for greyscale
printers. The number of bits per Postscript sample is
determined by the depth of the image.
-xwd Write output in _x_w_d format. Use this if you want to
convert to another output format with PPPPbbbbmmmm++++.
bbbbllllaaaacccckkkk aaaannnndddd
Write output in FIxwd -
xy ffffoooorrrrmmmmaaaatttt.... TTTThhhhiiiissss iiiissss lllliiiikkkkeeee xxxxwwwwdddd,,,, bbbbuuuutttt aaaalllllllloooowwwwssss
white images to be written with eight pixels per byte
instead of the default one pixel per byte. While xwud
and xpr will handle this format, some programs will
not.
-bm Write the output in X Bitmap format if the image is
black and white, or X Pixmap format if the image is
gray or color.
-bm2 Write the output in X Bitmap format if the image is
black and white, or X Pixmap format 2 if the image is
gray or color. -bm3 Write the output in X Bitmap
format if the image is black and white, or X Pixmap
Page 4 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
format 3 if the image is gray or color.
-puzzle
Write output in a format suitable for loading into the
_p_u_z_z_l_e program (see example below).
PPPPOOOOSSSSTTTTSSSSCCCCRRRRIIIIPPPPTTTT OOOOPPPPTTTTIIIIOOOONNNNSSSS
-compress
Enable or suppress Postscript image run-length
encoding. Postscript output is normally compressed to
minimize the size of output. If your printer can't
handle compressed output, you should use -_n_o_c_o_m_p_r_e_s_s to
turn off compression.
-eps Create Encapsulated Postscript output, rather than
normal stand-alone Postscript. This adds EPSF header
comments and removes all scaling and translation of the
image.
-l or -landscape
Use landscape layout (with page width and height
exchanged) for Postscript output. This option is
ignored if Encapsulated Postscript output is requested.
Width and height may be specified with the -page
option.
-bin Write Postscript output in binary rather than using
hexidecimal encoding. This causes the image portion of
the output to use half as much space, decreasing
transmission time to the printer. Note that not all
print spoolers can handle 8 bit binary data, so this
may not work on your system!
-limit
For Postscript output, check printer memory
availability before attempting to print an image (the
code to perform the checks is integrated into the
output of xgrabsc). This is turned off if Encapsulated
Postscript output is requested, and may be disabled
completely when building the xgrabsc program. On the
command line it may be turned off with -_n_o_l_i_m_i_t.
-preview or -prev
Selects Encapsulated Postscript output with an EPSI
preview image in its header. The preview image, if
necessary, is dithered to black and white either with a
default dithering algorithm or one you specify on the
command line (e.g., -_m_d_i_t_h_e_r). Programs such as Frame
use preview images to display the postscript image
during editing sessions. If you don't have a preview
Page 5 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
image, Frame will display a blank rectangle. The image
will print OK but you won't see it while editing.
-previewonly
Like -_p_r_e_v_i_e_w but writes only the preview portion, not
the postscript image. This may be used to add the
preview to an existing EPS file after having displayed
it using a PostScript interpreter.
-page _w_i_d_t_h_x_h_e_i_g_h_t-_m_a_r_g_i_n_W_i_d_t_h-_m_a_r_g_i_n_H_e_i_g_h_t
Sets the size of the paper and the borders you desire
around the edge of the paper. Xgrabsc will reduce the
image if necessary to keep it within the borders you
specify. The default page size and margins are set
when xgrabsc is built. Measurements are in inches
(e.g., 8.5x11.0-0.5-0.5)
PPPPRRRROOOOCCCCEEEESSSSSSSSIIIINNNNGGGG OOOORRRRDDDDEEEERRRR
It is helpful to know the order of processing when multiple
processing options are given on the command line.
Processing is done in five phases: 1) set up, 2) obtain
image, 3) process colors, 4) poly->monochrome conversions,
and 5) output conversion.
The set-up phase includes processing command-line options,
sleeping, connecting to X-Windows, freezing the screen, and
grabbing the mouse if necessary.
If the mouse is grabbed for rubber-banding, an upper-left-
corner cursor is displayed until the left mouse button is
pressed. A lower-left-corner cursor is then displayed while
drawing rubber-rectangles until the mouse button is
released.
If the mouse is grabbed for xwd-style window selection, an
xwd-style cursor is displayed until the left mouse button is
pressed.
The mouse is then released.
The bell is then run and the image is pulled from the
screen.
Following the image-grab, the bell is run twice and the
screen is released.
If the image is not monochrome, the color manipulation
functions are then applied in this order: brighten, AND, and
Page 6 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
OR, reverse.
Only one polychrome to monochrome conversion is allowed. If
none of these is chosen, the color table of a polychrome
image is compressed in preparation for output conversion.
The output stream is then opened and the image is written in
the selected output format.
EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT
XGRABSC - specifies command line arguments to be processed
before those actually entered on the command line.
DISPLAY - specifies the name of the display that xgrabsc
should grab from.
EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
The simplest form of use, giving Postscript output, is
xgrabsc >outfile.ps
To write output in _P_o_s_t_s_c_r_i_p_t format and send to the
printer, use
xgrabsc | lpr
It is sometimes helpful to brighten an image somewhat before
it is formatted for Postscript output. E.g., to brighten by
30%
xgrabsc -b 130 | lpr
If your printer supports color, and your display is color,
you can have xgrabsc generate color output instead of gray
scale:
xgrabsc -cps | lpr
The default Postscript output attempts to scale the image so
that it will all fit on one page, and is centered on the
page. If you are grabbing images to include in documents,
such as with FrameMaker, you should ask for Encapsulated
Postscript output with the -_e_p_s switch. For example:
xgrabsc -eps -o image1.eps
Page 7 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
To select an entire window, write output in _p_u_z_z_l_e format
and read into the puzzle program, use the commands
xgrabsc -click -puzzle >outfile.pzl
puzzle -picture outfile.pzl
To have xgrabsc sleep for three seconds before rubber-
banding, display processing information, and have the result
displayed with xwud,
xgrabsc -xwd -verbose -s 3 | xwud
To grab an image from another server and then reduce the
colormap to three bits by ANDing, use
xgrabsc -d other:0.0 -and 5 -bm >outfile.xpm
You will, of course, have to go to the other machine to
select the image with that machine's mouse.
LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS
Colormaps larger than 256 entries are not currently
supported. This means that it won't work with your fancy
24-bit display.
The default screen visual is used as the visual for the
image. Visuals are associated with particular windows, and
xgrabsc pretends ignorance about any windows but the root.
This software has been tested with StaticGray and 8-plane
PseudoColor on DECStations (using both UWS 2.2 and X11
Release 4). It has also been tested with 8-plane
PseudoColor on Sun SparcStations and various other platforms
using X11 Release 4 and Release 5.
X11 Pixmap format is rather verbose. You may want to run
large images through the _c_o_m_p_r_e_s_s utility before storing
them in a file. E.g.,
xgrabsc -bm | compress >outfile.xpm.Z
AAAAUUUUTTTTHHHHOOOORRRR
Bruce Schuchardt
Servio Corporation
bruce@slc.com
Page 8 (printed 7/7/95)
XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXGGGGRRRRAAAABBBBSSSSCCCC((((1111XXXX))))
AAAACCCCKKKKNNNNOOOOWWWWLLLLEEEEGGGGEEEEMMMMEEEENNNNTTTTSSSS
Some of the source code for xgrabsc came from the xloadimage
project by Jim Frost (jimf@saber.com) and others. Jim's
copyright has been included both here and in the source
code.
The idea for using run-length encoding for Postscript output
came from the xwd2ps project by Robert Tatar and Craig A.
McGowan.
The ad2c.sed script that makes it possible to let you run
xgrab without installing XGrab.ad everywhere is part of the
ad2c package developed by George Ferguson.
CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSSSS
Yves Arrouye wrote the EPS Preview and page-configuration
enhancements.
CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT
Copyright (c) 1990-93 Bruce Schuchardt
_X_g_r_a_b_s_c is copywritten material with a very loose copyright
allowing unlimited modification and distribution if the
copyright notices are left intact. Various portions are
copywritten by various people, but all use a modification of
the MIT copyright notice. Please check the cpyright.h for
complete copyright information. The intent is to keep the
source free, not to stifle its distribution, so please write
to me if you have any questions.
THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
X(1X), xhost(1), xwd(1X), xwud(1X), xwd2ps(1X),
xloadimage(1X), xpm(1X), xpr(1X), puzzle(1X), compress(1),
uncompress(1), xv(1X)
Page 9 (printed 7/7/95)